package com.young.redis.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.script.RedisScript;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;

@RestController
public class TestController {
    @Autowired
    private RedisTemplate<String, String> redisTemplate;

    @Autowired
    private RedisScript redisScript;

    private static final Long MAX=100000000L;

    @GetMapping("test")
    public String test() {
        ArrayList<String> list = new ArrayList<>();
        list.add("test");
        for (int i = 10000000; i < 10001000; i++) {
            String sorce = i+"."+(MAX-i);
            redisTemplate.execute(redisScript, list, sorce, i+"");
        }
        return "hello spring boot";
    }
}
